<template>
	<view class="store-card" v-for="item in storeList" :key="item.id">
		<view class="default-box" :class="{'mark': follow && item?.follow}">
			<navigator :url="`/pages/store/detail/index?storeId=${item?.id}`" class="img-box haptics-feedback">
				<image :src="item?.coverImage" mode="aspectFill"></image>
				<view class="tag">
					<text>相册</text>
					<nut-icon size="20rpx" name="rect-right"></nut-icon>
				</view>
			</navigator>
			<view class="right-content">
				<view class="name text-ellipsis">{{ item?.name }}</view>
				<view class="address text-ellipsis">{{ item?.address }}</view>
				<view class="bottom-row">
					<view class="tag">{{ item?.region }}</view>
					<view class="btns">
						<view class="btn haptics-feedback" @click="handleMakePhoneCall(item?.contactPhone)">
							<image class="phone-icon" src="/src/static/activity/detail/phone-icon.png" mode="aspectFill"></image>
							<text>咨询</text>
						</view>
						<view class="btn haptics-feedback">
						   <image class="site-icon" src="/src/static/activity/detail/site-icon.png" mode="aspectFill"></image>
							<text>导航</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="mark-row" v-if="follow && item?.follow">
			<image src="/src/static/store/shield-icon.png" mode="aspectFill"></image>
			<text>意向门店</text>
		</view>
	</view>
</template>

<script setup>
const { storeList, follow } = defineProps({
	storeList: {
		type: Array,
		default: []
	},
	follow: {
		type: Boolean,
		default: true
	}
})

const handleMakePhoneCall = (contactPhone) => {
	if (!contactPhone) return;
	uni.makePhoneCall({
		phoneNumber: contactPhone
	})
}
</script>

<style lang="scss" scoped>
.store-card {
	overflow: hidden;
	margin-bottom: 20rpx;
	border-radius: 30rpx;
	background: linear-gradient(to right, #FFAA00 0%, #FFEBE3 100%);
	&:last-of-type {
		margin-bottom: 0;
	}
	.default-box {
		overflow: hidden;
		height: 190rpx;
		padding: 22rpx;
		display: flex;
		align-items: center;
		gap: 16rpx;
		border-radius: 30rpx;
		border: 6rpx solid #FAFAFA;
		background-color: #FAFAFA;
		background-image: url('https://free.picui.cn/free/2025/10/17/68f24f4386fdb.png');
		background-repeat: no-repeat;
		background-size: 588rpx 178rpx;
		background-position: top right;
		.img-box {
			position: relative; 
			overflow: hidden;
			width: 146rpx;
			height: 146rpx;
			border-radius: 20rpx;
			flex-shrink: 0;
			image {
				width: 100%;
				height: 100%;
			}
			.tag {
				position: absolute;
				z-index: 1;
				right: 6rpx;
				bottom: 6rpx;
				height: 30rpx;
				padding-left: 10rpx;
				display: flex;
				align-items: center;
				border-radius: 30rpx;
				font-size: 20rpx;
				color: #fff;
				background: rgba(0, 0, 0, 0.53);
				text {
					margin-right: -8rpx;
				}
			}
		}
		.right-content {
			flex: 1;
			overflow: hidden;
			.name {
				margin-bottom: 10rpx;
			}
			.address {
				font-size: 24rpx;
				color: #888D99;
				margin-bottom: 16rpx;
			}
			.bottom-row {
				display: flex;
				align-items: center;
				justify-content: space-between;
				gap: 20rpx;
				.tag {
					height: 38rpx;
					padding: 0 12rpx;
					font-size: 24rpx;
					color: #555E6D;
					border-radius: 38rpx;
					background-color: #EBEEF2;
				}
				.btns {
					display: flex;
					align-items: cente r;
					gap: 10rpx;
					.btn {
						width: 116rpx;
						height: 50rpx;
						display: flex;
						align-items: center;
						justify-content: center;
						gap: 8rpx;
						border-radius: 50rpx;
						border: 1rpx solid #E8ECF4;
						background-color: #fff;
						.phone-icon {
							width: 24rpx;
							height: 26rpx;
						}
						.site-icon {
							width: 18rpx;
							height: 22rpx;
						}
						text {
							font-size: 24rpx;
							color: #535B6B;
						}
					}
				}
			}
		}
	}
	.mark {
		border: none;
		background-image: url('https://free.picui.cn/free/2025/10/17/68f24ce92f9cd.png');
		background-size: 100% 100%;
	}
	.mark-row {
		height: 50rpx;
		display: flex;
		align-items: center;
		gap: 8rpx;
		padding: 0 24rpx;
		background: linear-gradient(to right, #FFAA00 0%, #FFEBE3 100%);
		image {
			width: 26rpx;
			height: 32rpx;
		}
		text {
			font-weight: 700;
			color: #7A2300;
		}
	}
}
</style>